package br.com.affero.util;

import org.hibernate.Session;
import org.hibernate.cfg.Configuration;

public final class HibernateUtil {

	private static HibernateUtil instance;
	private Session session;
	
	private HibernateUtil() {				
	}
	
	public static HibernateUtil getInstance() {
		if (instance == null) {
			instance = new HibernateUtil();
		}
		return instance;
	}
	
	public Session openSession() {
		session = new Configuration().configure().buildSessionFactory().openSession(); 
		return session;
	}
	
	public Session getSession() {
		return session;
	}
	
}
